package controllers

import (
	"github.com/gin-gonic/gin"
	"social-app/models"
	"social-app/pkg/response"
)

type DynamicCategoryController struct{}

type DynamicCategoryListResponse struct {
	Id   int    `json:"id"`
	Name string `json:"name"`
}

func (d DynamicCategoryController) GetList(c *gin.Context) {
	list, _ := models.GetDynamicCategoryList()
	var ListResponse []DynamicCategoryListResponse
	for _, category := range list {
		ListResponse = append(ListResponse, DynamicCategoryListResponse{
			Id:   category.Id,
			Name: category.Name,
		})
	}
	response.Success(c, "获取分类成功", ListResponse)
}
